<template>
	<view class="detail">
		<view class="steps">
			<view class="step-item">
				<view class="dot" :class="{'active-dot': step >= 1}">
					<text>1</text>
				</view>
				<text>用车申请</text>
			</view>
			<view class="step-item">
				<view class="dot" :class="{'active-dot': step >= 2}">
					<text>2</text>
				</view>
				<text>申请审核</text>
			</view>
			<view class="step-item" :class="{'active-dot': step >= 3}">
				<view class="dot">
					<text>3</text>
				</view>
				<text>申请完成</text>
			</view>
		</view>
		
		<view class="container">
			<view class="flex">
				<view class="status status-active margin-b16">
					<text>{{ info.status_msg }}</text>
				</view>
			</view>
			<view class="order-info">
				<view class="">
					<text>提交人：{{ info.roster_name }}</text>
				</view>
				<view class="">
					<text>提交时间：{{info.add_time}}</text>
				</view>
				<view class="">
					<text>目的地：{{info.car_destination}}</text>
				</view>
				<view class="">
					<text>出车时间：{{info.start_time}}</text>
				</view>
				
				<view class="">
					<text>预计还车：{{info.end_time}}</text>
				</view>
				<view class="">
					<text>申请单类型：{{info.form_type_msg}}</text>
				</view>
				<view class="">
					<text>申请人：{{info.applicant_name}}</text>
				</view>
				<view class="">
					<text>申请人电话：{{info.applicant_phone}}</text>
				</view>
				<view class="">
					<text>{{info.form_type !== 3 ? '用车事由' : '文件类型'}}：{{info.applicant_phone}}</text>
				</view>
				<view class="">
					<text>用户需求：{{info.car_demand}}</text>
				</view>
				<view class="">
					<text>用户需求：{{info.car_demand}}</text>
				</view>
				<view class="">
					<text>{{info.form_type !== 3 ? '目的地' : '配送地址'}}：{{info.car_destination}}</text>
				</view>
				<view class="">
					<text>{{info.form_type !== 3 ? '出发时间' : '配送时间'}}：{{info.start_time}}</text>
				</view>
				<view class="">
					<text>申请单备注：{{info.remark}}</text>
				</view>
			</view>
			
			<view class="list">
				<view class="item" v-for="(item, index) in info.car_data" :key="index">
					<view class="flex align-center justify-between">
						<view class="car-name">
							<text>{{item.pinpai}}</text>
						</view>
						<view class="num-wrap">
							<text class="num">{{item.count}}</text>
							<text>辆</text>
						</view>
					</view>
					<!-- <view class="attr">
						<text>2.0T/7座</text>
					</view> -->
					<view class="info">
						<view class="">
							<text>{{ item.is_driver ? '不需要司机' : '需要司机' }}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<view style="height: 140rpx;"></view>
		
		<view class="footer" :style="{'padding-bottom': safeAreaBottom ? safeAreaBottom+'px' : '24rpx'}">
			<button>
				<text>不同意</text>
			</button>
			<button @click="signature">
				<text>同意</text>
			</button>
		</view>
		
		<signature ref="signature" @confirm="confirmSign" @close="closeSign"></signature>
	</view>
</template>

<script>
	import { mapState } from 'vuex'
 	export default {
		data() {
			return {
				step: 2,
				orderId: '',
				info: {}
			};
		},
		computed: {
			...mapState('common', ['safeAreaBottom'])
		},
		onLoad(options) {
			this.orderId = options.orderId
			this.getInfo()
		},
		methods:{
			getInfo() {
				this.$api.orderDetailsApi({id: this.orderId}).then(res=>{
					console.log('详情', res);
					this.info = res.data
				}).catch(err=>{
					console.log(err);
				})
			},
			signature() {
				this.$refs.signature.show()
			},
			confirmSign(val) {
				// uni.saveImageToPhotosAlbum({
				// 	filePath: val,
				// 	success: function () {
				// 		console.log('save success');
				// 	}
				// });
			},
			closeSign() {
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.detail{
		
		.steps{
			width: 100%;
			display: flex;
			padding: 32rpx;
			align-items: center;
			box-sizing: border-box;
			background-color: #FFFFFF;
			justify-content: space-between;
			
			.step-item{
				display: flex;
				flex-shrink: 0;
				font-size: 28rpx;
				align-items: center;
				flex-direction: column;
				justify-content: center;
				
				&:first-child{
					.dot{
						&::after{
							display: none;
						}
					}
					.active-dot{
						&::after{
							display: none;
						}
					}
				}
			}
			
			.dot{
				position: relative;
				width: 56rpx;
				height: 56rpx;
				display: flex;
				flex-shrink: 0;
				color: #ababab;
				border-radius: 50%;
				margin-bottom: 8rpx;
				align-items: center;
				box-sizing: border-box;
				justify-content: center;
				border: 1px solid #ababab;
				
				&::after{
					position: absolute;
					content: '';
					top: 50%;
					right: 160%;
					width: 320%;
					height: 1px;
					background-color: #ababab;
				}
				
			}
			
			.active-dot {
				color: #FFFFFF;
				background-color: var(--primary-color);
				border: 1rpx solid var(--primary-color);
				
				
				&::after{
					background-color: var(--primary-color);
				}
				
			}
		}
		
		.container{
			padding: 0 32rpx;
			padding-bottom: 32rpx;
			box-sizing: border-box;
			background-color: #FFFFFF;
		}
		
		.order-info{
			font-weight: 400;
			font-size: 26rpx;
			line-height: 44rpx;
			color: rgba(0, 0, 0, 0.9);
		}
		
		.status{
			// width: 192rpx;
			height: 48rpx;
			padding: 0 24rpx;
			font-weight: 400;
			font-size: 24rpx;
			display: flex;
			line-height: 40rpx;
			border-radius: 4rpx;
			align-items: center;
			justify-content: center;
			color: rgba(0, 0, 0, 0.6);
			background: rgba(0, 0, 0, 0.1);
		}
		
		.status-active{
			color: #ED7B2F;
			background: rgba(237, 123, 47, 0.1);
		}
		
		.status-complate{
			color: rgba(87, 147, 127, 1);
			background-color: rgba(87, 147, 127, 0.5);
		}
		
		.list{
			padding-top: 16rpx;
		}
		
		.item{
			flex-shrink: 0;
			padding: 32rpx;
			margin-bottom: 32rpx;
			border-radius: 12rpx;
			border: 1rpx solid #999;
			
			.car-name{
				color: #000000;
				font-weight: 600;
				font-size: 34rpx;
				line-height: 44rpx;
			}
			
			.car-type{
				color: #000000;
				font-weight: 400;
				font-size: 28rpx;
				line-height: 44rpx;
				padding-left: 8rpx;
				display: inline-block;
			}
			
			.num-wrap{
				font-weight: 400;
				font-size: 34rpx;
				line-height: 44rpx;
				color: #000000;
			}
			
			.num{
				color: #ED7B2F;
				font-weight: 600;
			}
			
			.attr{
				font-weight: 400;
				font-size: 26rpx;
				line-height: 44rpx;
				color: rgba(0, 0, 0, 0.3);
			}
			
			.info{
				font-weight: 400;
				font-size: 26rpx;
				padding-top: 6rpx;
				line-height: 44rpx;
				color: rgba(0, 0, 0, 0.6);
			}
		}
	
		.footer{
			position: fixed;
			left: 0;
			right: 0;
			bottom: 0;
			width: 100%;
			z-index: 9999;
			display: flex;
			padding: 32rpx;
			align-items: center;
			box-sizing: border-box;
			background-color: #FFFFFF;
			justify-content: space-between;
			box-shadow: 0rpx 0rpx 22rpx rgba(0, 0, 0, 0.1);
			
			button{
				width: 100%;
				color: #FFFFFF;
				
				&::after{
					border: none;
				}
				
				&:first-child{
					background-color: #a5daf5;
				}
				
				&:last-child{
					margin-left: 24rpx;
					background-color: var(--primary-color);
				}
			}
		}
	}
</style>
